package com.bill.springcloud.ribbon.service;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @fileName: HelloService.java
 * @author: bin.li01
 * @date: 2018/2/1 10:47
 * @version: v1.0.0
 */
@Service
public class HelloService {

    @Resource
    private RestTemplate restTemplate;

    /**
     * 调用已经注册到服务（eureka-server）的eureka-client应用中的接口
     * @param name
     * @return
     */

    public String helloFromEurekaClient(@RequestParam(value = "name") String name){
        return restTemplate.getForObject("http://EUREKA-CLIENT/hello?name=" + name,String.class);
    }

}
